<?php
require_once dirname(dirname(dirname(__FILE__))) . '/init.php';
/**
 *系统驳回调拨申请
 */
class StoryTransferApplyReject extends Controller_CronJob {
	public function run() {
		$stockTransferApplyModel = new Cron_Model_Backup_StockTransferApply();
		$waitCheckList = $stockTransferApplyModel->getWaitCheckApply();
		if (empty($waitCheckList)) {
			$msg = "系统自动驳回需求调拨申请:待审核列表为空！";
			$this->log->record($msg);
			exit($msg);
		}

		$failReject = [];
		foreach ($waitCheckList as $waitCheckApply) {
			$stockTransferApplyModel->rejectBySystem();
		}

		if (!empty($failReject)) {
			$msg = date("Y-m-d") . "日系统自动驳回需求调拨申请完成！";
			$this->log($msg);
			exit($msg);
		}
		exit('系统自动驳回需求调拨申请有错误发生！错误详细见日志！');
	}
}

$storyTransferApplyReject = new StoryTransferApplyReject();
$storyTransferApplyReject->run();